<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>海内存知已，天涯若比邻 - 无唯</title><meta name="keywords" content="关键字"><meta name="author" content="mowei"><meta name="copyright" content="mowei"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="没事瞎记记，生活更有趣">
<meta property="og:type" content="website">
<meta property="og:title" content="海内存知已，天涯若比邻">
<meta property="og:url" content="https://gitee.com/momomomowei/page/4/index.html">
<meta property="og:site_name" content="海内存知已，天涯若比邻">
<meta property="og:description" content="没事瞎记记，生活更有趣">
<meta property="og:locale" content="zh_CN">
<meta property="og:image" content="https://gitee.com/momomomowei/media/avatar.jpg">
<meta property="article:author" content="mowei">
<meta property="article:tag" content="关键字">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://gitee.com/momomomowei/media/avatar.jpg"><link rel="shortcut icon" href="/media/favicon.png"><link rel="canonical" href="https://gitee.com/momomomowei/page/4/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: undefined,
  localSearch: {"path":"search.xml","languages":{"hits_empty":"找不到您查询的内容：${query}"}},
  translate: {"defaultEncoding":2,"translateDelay":0,"msgToTraditionalChinese":"繁","msgToSimplifiedChinese":"簡"},
  noticeOutdate: undefined,
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":false},
  copy: {
    success: '复制成功',
    error: '复制错误',
    noSupport: '浏览器不支持'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: '天',
  date_suffix: {
    just: '刚刚',
    min: '分钟前',
    hour: '小时前',
    day: '天前',
    month: '个月前'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    jQuery: 'https://cdn.jsdelivr.net/npm/jquery@latest/dist/jquery.min.js',
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/js/jquery.justifiedGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/justifiedGallery/dist/css/justifiedGallery.min.css'
    },
    fancybox: {
      js: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.js',
      css: 'https://cdn.jsdelivr.net/npm/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css'
    }
  },
  isPhotoFigcaption: true,
  islazyload: true,
  isanchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: '海内存知已，天涯若比邻',
  isPost: false,
  isHome: true,
  isHighlightShrink: false,
  isToc: false,
  postUpdate: '2024-04-21 15:25:55'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const fontSizeVal = saveToLocal.get('global-font-size')
    if (fontSizeVal !== undefined) {
      document.documentElement.style.setProperty('--global-font-size', fontSizeVal + 'px')
    }
    
    const detectApple = () => {
      if (GLOBAL_CONFIG_SITE.isHome && /iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    document.addEventListener('pjax:complete', detectApple)})(window)</script><meta name="generator" content="Hexo 5.4.2"></head><body><div id="loading-box"><div class="loading-left-bg"></div><div class="loading-right-bg"></div><div class="spinner-box"><div class="configure-border-1"><div class="configure-core"></div></div><div class="configure-border-2"><div class="configure-core"></div></div><div class="loading-word">加载中...</div></div></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src= "" data-lazy-src="/media/avatar.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">41</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">29</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">7</div></a></div></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 目录</span><i class="fas fa-chevron-down expand hide"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div></div></div><div class="page" id="body-wrap"><header class="full_page" id="page-header" style="background-image: url('/media/bg.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">海内存知已，天涯若比邻</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> 搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> 主页</span></a></div><div class="menus_item"><a class="site-page" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> 目录</span><i class="fas fa-chevron-down expand hide"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> 分类</span></a></li><li><a class="site-page child" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> 标签</span></a></li><li><a class="site-page child" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> 归档</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> 关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="site-info"><h1 id="site-title">海内存知已，天涯若比邻</h1><div id="site-subtitle"><span id="subtitle"></span></div><div id="site_social_icons"><a class="social-icon" href="mailto:你的邮箱" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div id="scroll-down"><i class="fas fa-angle-down scroll-down-effects"></i></div></header><main class="layout" id="content-inner"><div class="recent-posts" id="recent-posts"><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/docker/docker%20%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85/" title="docker 安装">     <img class="post_bg" src= "" data-lazy-src="/images/docker_cover.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="docker 安装"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/docker/docker%20%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85/" title="docker 安装">docker 安装</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/docker/">docker</a></span></div><div class="content">一、Docker 安装1.卸载旧版本12345678yum remove docker \    docker-client \    docker-client-latest \    docker-common \    docker-latest \    docker-latest-logrotate \    docker-logrotate \    docker-engine
2.yum安装gcc相关123yum -y install gccyum -y install gcc-c++yum install -y yum-utils
3.设置stable镜像仓库1yum-config-manager --add-repo http://mirrors.aliyun.com/docker-ce/linux/centos/docker-ce.repo
4.更新yum软件包索引1yum makecache fast
5.安装DOCKER CE1yum -y install docker-ce docker-ce-cli containerd.io
6.启动docker1234s ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/docker/docker%E9%83%A8%E7%BD%B2minio/" title="docker部署minio">     <img class="post_bg" src= "" data-lazy-src="/images/minio_cover.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="docker部署minio"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/docker/docker%E9%83%A8%E7%BD%B2minio/" title="docker部署minio">docker部署minio</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/docker/">docker</a></span></div><div class="content">下载镜像1docker pull minio/minio
运行镜像

MINIO_ROOT_USER：设置用户名，不少于4位

MINIO_ROOT_PASSWORD：设置密码，不少于8位

/minio/data：文件的存储地址

/minio/config：minio的相关配置文件 注意！！！此处使用的是9000端口，需在服务器安全组添加9000端口

-p 9000:9000 —console-address “:9000” 挂载9000端口为web端口
-p 9001:9001 —address “:9001” 挂载9001端口为客户端（如Java客户端）访问的端口


123456789101112docker run \  -p 9000:9000 \  -p 9001:9001 \  --name minio \  -di \  --restart=always \  -e MINIO_ROOT_USER=&quot;root&quot; \  -e MINIO_ROOT_PASSWORD=&quot;root123456&quot; \  -v /minio/data: ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/nginx/Nginx%20%E9%85%8D%E7%BD%AE%E8%AF%A6%E8%A7%A3%20/" title="Nginx 配置详解">     <img class="post_bg" src= "" data-lazy-src="/images/nginx.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Nginx 配置详解"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/nginx/Nginx%20%E9%85%8D%E7%BD%AE%E8%AF%A6%E8%A7%A3%20/" title="Nginx 配置详解">Nginx 配置详解</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/nginx/">nginx</a></span></div><div class="content">1. Nginx 介绍传统的 Web 服务器，每个客户端连接作为一个单独的进程或线程处理，需在切换任务时将 CPU 切换到新的任务并创建一个新的运行时上下文，消耗额外的内存和 CPU 时间，当并发请求增加时，服务器响应变慢，从而对性能产生负面影响。

Nginx 是开源、高性能、高可靠的 Web 和反向代理服务器，而且支持热部署，几乎可以做到 7 * 24 小时不间断运行，即使运行几个月也不需要重新启动，还能在不间断服务的情况下对软件版本进行热更新。性能是 Nginx 最重要的考量，其占用内存少、并发能力强、能支持高达 5w 个并发连接数，最重要的是，Nginx 是免费的并可以商业化，配置使用也比较简单。
Nginx 的最重要的几个使用场景：

静态资源服务，通过本地文件系统提供服务；
反向代理服务，延伸出包括缓存、负载均衡等；
API 服务，OpenResty ；

对于前端来说 Node.js 不陌生了，Nginx 和 Node.js 的很多理念类似，HTTP 服务器、事件驱动、异步非阻塞等，且 Nginx 的大部分功能使用 Node.js 也可以实现，但 Nginx 和 Node ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/nginx/Nginx%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/" title="Nginx安装配置">     <img class="post_bg" src= "" data-lazy-src="/images/nginx.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Nginx安装配置"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/nginx/Nginx%E5%AE%89%E8%A3%85%E9%85%8D%E7%BD%AE/" title="Nginx安装配置">Nginx安装配置</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/nginx/">nginx</a></span></div><div class="content">0、Nginx 安装
关于版本：
Nginx开源版    http://nginx.org/
Nginx plus 商业版    https://www.nginx.com
openresty    http://openresty.org/cn/
Tengine    http://tengine.taobao.org/

1、下载上传文件
2、编译安装
123./configure --prefix=/usr/local/nginxmakemake install

如果出现警告，安装依赖
yum install -y gcc
yum install -y pcre pcre-devel
yum install -y zlib zlib-devel

3、启动Nginx
进入安装好的目录/usr/local/nginx/sbin
1234./nginx 			启动./nginx -s stop 	快速停止./nginx -s quit 	优雅关闭，在退出前完成已经接受的连接请求./nginx -s reload 	重新加载配置

关闭防火墙systemctl stop firewa ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/jenkins/Jenkins/" title="Jenkins 简单使用">     <img class="post_bg" src= "" data-lazy-src="/images/jenkins_cover.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Jenkins 简单使用"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/jenkins/Jenkins/" title="Jenkins 简单使用">Jenkins 简单使用</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/jenkins/">jenkins</a></span></div><div class="content">1.GitLab安装使用1.在ssh下安装官方安装文档：https://gitlab.cn/install/?version=ce
1 安装依赖123sudo yum install -y curl policycoreutils-python openssh-server perlsudo systemctl enable sshdsudo systemctl start sshd
2 配置镜像1curl -fsSL https://packages.gitlab.cn/repository/raw/scripts/setup.sh | /bin/bash
3 开始安装1sudo EXTERNAL_URL=&quot;http://192.168.44.103&quot; yum install -y gitlab-jh
除非您在安装过程中指定了自定义密码，否则将随机生成一个密码并存储在 /etc/gitlab/initial_root_password 文件中(出于安全原因，24 小时后，此文件会被第一次 gitlab-ctl reconfigure 自动删除，因此若使用随机密码登 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/utils/base64%E3%80%81url%E3%80%81blob%E4%BA%92%E7%9B%B8%E8%BD%AC%E6%8D%A2/" title="base64、url、blob互相转换">     <img class="post_bg" src= "" data-lazy-src="/images/tran.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="base64、url、blob互相转换"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/utils/base64%E3%80%81url%E3%80%81blob%E4%BA%92%E7%9B%B8%E8%BD%AC%E6%8D%A2/" title="base64、url、blob互相转换">base64、url、blob互相转换</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0/">工具函数</a></span></div><div class="content">base64到blobUrl12345678910111213141516function imageBase64ToBlob(urlData, type = &#x27;image/png&#x27;) &#123;	try &#123;		var arr = urlData.split(&#x27;,&#x27;)		var mime = arr[0].match(/:(.*?);/)[1] || type;		var bytes = window.atob(arr[1]);		var ab = new ArrayBuffer(bytes.length);		var ia = new Uint8Array(ab);		for (var i = 0; i &lt; bytes.length; i++) &#123;			ia[i] = bytes.charCodeAt(i);		&#125;		return URL.createObjectURL(new Blob([ab], &#123; type: mime &#125;))	&#125;	catch (e) &#123;		re ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/utils/blob%20%E7%82%B9%E5%87%BB%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6/" title="blob 点击下载文件">     <img class="post_bg" src= "" data-lazy-src="/images/download_cover.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="blob 点击下载文件"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/utils/blob%20%E7%82%B9%E5%87%BB%E4%B8%8B%E8%BD%BD%E6%96%87%E4%BB%B6/" title="blob 点击下载文件">blob 点击下载文件</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0/">工具函数</a></span></div><div class="content">
注意 axios 要设置 { responseType: ‘blob’ }

1234567891011121314151617181920blobDownload(blob, fileName) &#123;    if (window.navigator.msSaveOrOpenBlob) &#123;        navigator.msSaveBlob(blob, fileName)    &#125; else &#123;        const link = document.createElement(&#x27;a&#x27;)        const body = document.querySelector(&#x27;body&#x27;)        link.href = window.URL.createObjectURL(blob) // 创建对象url        link.download = fileName        // fix Firefox        link.style.display = &#x27;none&#x2 ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/utils/canvas%20%E9%A1%B5%E9%9D%A2%E6%B0%B4%E5%8D%B0/" title="canvas 页面水印">     <img class="post_bg" src= "" data-lazy-src="/images/canvas.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="canvas 页面水印"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/utils/canvas%20%E9%A1%B5%E9%9D%A2%E6%B0%B4%E5%8D%B0/" title="canvas 页面水印">canvas 页面水印</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2023-03-18T06:06:43.000Z" title="发表于 2023-03-18 14:06:43">2023-03-18</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0/">工具函数</a></span></div><div class="content">添加水印12345678910111213141516171819202122232425262728293031323334353637383940414243444546const setWatermark = (str: string) =&gt; &#123;    const id = &#x27;1.23452384164.123412416&#x27;;    if (document.getElementById(id) !== null) document.body.removeChild(&lt;HTMLElement&gt;document.getElementById(id));    const can = document.createElement(&#x27;canvas&#x27;);    can.width = 200;    can.height = 130;    const cans = &lt;CanvasRenderingContext2D&gt;can.getContext(&#x27;2d&#x27;);    cans.rotate ...</div></div></div><div class="recent-post-item"><div class="post_cover left_radius"><a href="/blog/linux/Linux/" title="Linux 常用">     <img class="post_bg" src= "" data-lazy-src="/images/linux.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Linux 常用"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/linux/Linux/" title="Linux 常用">Linux 常用</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-16T11:43:06.000Z" title="发表于 2021-09-16 19:43:06">2021-09-16</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span></div><div class="content">00、参考地址01、基础操作1、开机物理机服务器：按下电源开关，就像Windows开机一样。
本地虚拟机：在VMware中点击“开启此虚拟机”。
2、重启和关机重启和关机需要系统管理员用户权限。
1）重启
1init 6 或 reboot
2）关机
1init 0 或 halt
如果没有执行关机命令，强制断电或关闭本地虚拟机的窗口，会导致Linux操作系统文件的损坏，严重的可能导致系统无法正常启动。
3、清屏1clear 或 ctrl + L
清除当前屏幕上显示的内容。
4、查看服务器的ip地址1ip addr 或者 ifconfig

上图中，框中显示的就是IP地址。
5、时间操作普通用户可以查看时间，但设置时区和时间要系统管理员用户登录 。
1）查看时间。
1date
2）设置时区为中国上海时间（注意不是北京时间）。
1cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
3）设置时间。
1date -s &quot;yyyy-mm-dd hh:mi:ss&quot;
例如：date -s “2020-01-02 12:35:28” ...</div></div></div><div class="recent-post-item"><div class="post_cover right_radius"><a href="/blog/linux/centos7%20%E5%9B%BA%E5%AE%9Aip%E5%9C%B0%E5%9D%80/" title="centos7 固定ip地址">     <img class="post_bg" src= "" data-lazy-src="/images/centos.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="centos7 固定ip地址"></a></div><div class="recent-post-info"><a class="article-title" href="/blog/linux/centos7%20%E5%9B%BA%E5%AE%9Aip%E5%9C%B0%E5%9D%80/" title="centos7 固定ip地址">centos7 固定ip地址</a><div class="article-meta-wrap"><span class="post-meta-date"><i class="far fa-calendar-alt"></i><span class="article-meta-label">发表于</span><time datetime="2021-09-16T11:43:06.000Z" title="发表于 2021-09-16 19:43:06">2021-09-16</time></span><span class="article-meta"><span class="article-meta__separator">|</span><i class="fas fa-inbox"></i><a class="article-meta__categories" href="/categories/Linux/">Linux</a></span></div><div class="content">1 参考链接https://www.likecs.com/show-205123794.html#1%E4%BB%A5%E7%B3%BB%E7%BB%9F%E7%AE%A1%E7%90%86%E5%91%98%E6%89%93%E5%BC%80vmware
https://www.cnblogs.com/wucongzhou/p/12588705.html
2 默认网络文件
修改虚拟机网卡配置文件，如/etc/sysconfig/network-scripts/ifcfg-ens33，注意，文件名不一定是ifcfg-ens33，根据您的实际情况决定

1cd /etc/sysconfig/network-scripts
123456789101112131415TYPE=EthernetPROXY_METHOD=noneBROWSER_ONLY=noBOOTPROTO=dhcpDEFROUTE=yesIPV4_FAILURE_FATAL=noIPV6INIT=yesIPV6_AUTOCONF=yesIPV6_DEFROUTE=yesIPV6_FAILURE_FATAL=noIPV6_A ...</div></div></div><nav id="pagination"><div class="pagination"><a class="extend prev" rel="prev" href="/page/3/#content-inner"><i class="fas fa-chevron-left fa-fw"></i></a><a class="page-number" href="/">1</a><span class="space">&hellip;</span><a class="page-number" href="/page/3/#content-inner">3</a><span class="page-number current">4</span><a class="page-number" href="/page/5/#content-inner">5</a><a class="extend next" rel="next" href="/page/5/#content-inner"><i class="fas fa-chevron-right fa-fw"></i></a></div></nav></div><div class="aside-content" id="aside-content"><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>公告</span></div><div class="announcement_content">一切解释权归本咸鱼所有</div></div><div class="sticky_layout"><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/blog/java/01%20Spring%20Security%20&amp;%20oauth2/" title="Spring Security &amp; Oauth2"><img src= "" data-lazy-src="/images/spring-security.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Spring Security &amp; Oauth2"/></a><div class="content"><a class="title" href="/blog/java/01%20Spring%20Security%20&amp;%20oauth2/" title="Spring Security &amp; Oauth2">Spring Security &amp; Oauth2</a><time datetime="2024-04-25T07:24:45.000Z" title="发表于 2024-04-25 15:24:45">2024-04-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/java/02%20JWT%E5%B7%A5%E5%85%B7%E7%B1%BB/" title="JWT工具类"><img src= "" data-lazy-src="/images/jwt.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="JWT工具类"/></a><div class="content"><a class="title" href="/blog/java/02%20JWT%E5%B7%A5%E5%85%B7%E7%B1%BB/" title="JWT工具类">JWT工具类</a><time datetime="2024-04-25T07:24:45.000Z" title="发表于 2024-04-25 15:24:45">2024-04-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/java/00%20Security%20%E9%9B%86%E6%88%90%E7%A4%BA%E4%BE%8B/" title="SpringSecurity 集成示例"><img src= "" data-lazy-src="/images/spring-security.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="SpringSecurity 集成示例"/></a><div class="content"><a class="title" href="/blog/java/00%20Security%20%E9%9B%86%E6%88%90%E7%A4%BA%E4%BE%8B/" title="SpringSecurity 集成示例">SpringSecurity 集成示例</a><time datetime="2024-04-25T07:24:43.000Z" title="发表于 2024-04-25 15:24:43">2024-04-25</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/java/101%20Mybatis-plus%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90/" title="MybatisPlus 快速集成"><img src= "" data-lazy-src="/images/mybatis-plus.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="MybatisPlus 快速集成"/></a><div class="content"><a class="title" href="/blog/java/101%20Mybatis-plus%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90/" title="MybatisPlus 快速集成">MybatisPlus 快速集成</a><time datetime="2024-04-21T07:39:43.000Z" title="发表于 2024-04-21 15:39:43">2024-04-21</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/blog/java/10%20Mybatis%20%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90/" title="Mybatis 快速集成"><img src= "" data-lazy-src="/images/mybaits.jpeg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Mybatis 快速集成"/></a><div class="content"><a class="title" href="/blog/java/10%20Mybatis%20%E5%BF%AB%E9%80%9F%E9%9B%86%E6%88%90/" title="Mybatis 快速集成">Mybatis 快速集成</a><time datetime="2024-04-21T07:24:43.000Z" title="发表于 2024-04-21 15:24:43">2024-04-21</time></div></div></div></div><div class="card-widget card-categories"><div class="item-headline">
            <i class="fas fa-folder-open"></i>
            <span>分类</span>
            
            </div>
            <ul class="card-category-list" id="aside-cat-list">
            <li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Java/"><span class="card-category-list-name">Java</span><span class="card-category-list-count">15</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/Linux/"><span class="card-category-list-name">Linux</span><span class="card-category-list-count">5</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/docker/"><span class="card-category-list-name">docker</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/jenkins/"><span class="card-category-list-name">jenkins</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/nginx/"><span class="card-category-list-name">nginx</span><span class="card-category-list-count">2</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%89%8D%E7%AB%AF/"><span class="card-category-list-name">前端</span><span class="card-category-list-count">6</span></a></li><li class="card-category-list-item "><a class="card-category-list-link" href="/categories/%E5%B7%A5%E5%85%B7%E5%87%BD%E6%95%B0/"><span class="card-category-list-name">工具函数</span><span class="card-category-list-count">9</span></a></li>
            </ul></div><div class="card-widget card-tags"><div class="item-headline"><i class="fas fa-tags"></i><span>标签</span></div><div class="card-tag-cloud"><a href="/tags/Base64/" style="font-size: 1.1em; color: #999">Base64</a> <a href="/tags/Blob/" style="font-size: 1.15em; color: #999b9e">Blob</a> <a href="/tags/JWT/" style="font-size: 1.1em; color: #999">JWT</a> <a href="/tags/Java/" style="font-size: 1.5em; color: #99a9bf">Java</a> <a href="/tags/Linux/" style="font-size: 1.3em; color: #99a1ac">Linux</a> <a href="/tags/Mybatis/" style="font-size: 1.15em; color: #999b9e">Mybatis</a> <a href="/tags/Oauth2/" style="font-size: 1.1em; color: #999">Oauth2</a> <a href="/tags/Pinia/" style="font-size: 1.1em; color: #999">Pinia</a> <a href="/tags/RabbitMQ/" style="font-size: 1.1em; color: #999">RabbitMQ</a> <a href="/tags/React/" style="font-size: 1.15em; color: #999b9e">React</a> <a href="/tags/Redis/" style="font-size: 1.15em; color: #999b9e">Redis</a> <a href="/tags/Security/" style="font-size: 1.15em; color: #999b9e">Security</a> <a href="/tags/SpringBoot/" style="font-size: 1.4em; color: #99a5b6">SpringBoot</a> <a href="/tags/Vue/" style="font-size: 1.25em; color: #999fa7">Vue</a> <a href="/tags/canvas/" style="font-size: 1.1em; color: #999">canvas</a> <a href="/tags/centos/" style="font-size: 1.1em; color: #999">centos</a> <a href="/tags/docker/" style="font-size: 1.1em; color: #999">docker</a> <a href="/tags/jdk/" style="font-size: 1.1em; color: #999">jdk</a> <a href="/tags/jenkins/" style="font-size: 1.15em; color: #999b9e">jenkins</a> <a href="/tags/maven/" style="font-size: 1.1em; color: #999">maven</a> <a href="/tags/minio/" style="font-size: 1.1em; color: #999">minio</a> <a href="/tags/mysql/" style="font-size: 1.1em; color: #999">mysql</a> <a href="/tags/nacos/" style="font-size: 1.1em; color: #999">nacos</a> <a href="/tags/nginx/" style="font-size: 1.2em; color: #999da3">nginx</a> <a href="/tags/tomcat/" style="font-size: 1.1em; color: #999">tomcat</a> <a href="/tags/uni-app/" style="font-size: 1.1em; color: #999">uni-app</a> <a href="/tags/web/" style="font-size: 1.35em; color: #99a3b1">web</a> <a href="/tags/%E5%89%8D%E7%AB%AF/" style="font-size: 1.45em; color: #99a7ba">前端</a> <a href="/tags/%E6%B0%B4%E5%8D%B0/" style="font-size: 1.1em; color: #999">水印</a></div></div><div class="card-widget card-archives"><div class="item-headline"><i class="fas fa-archive"></i><span>归档</span></div><ul class="card-archive-list"><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/04/"><span class="card-archive-list-date">四月 2024</span><span class="card-archive-list-count">18</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/03/"><span class="card-archive-list-date">三月 2024</span><span class="card-archive-list-count">2</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/02/"><span class="card-archive-list-date">二月 2024</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2024/01/"><span class="card-archive-list-date">一月 2024</span><span class="card-archive-list-count">7</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/11/"><span class="card-archive-list-date">十一月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/04/"><span class="card-archive-list-date">四月 2023</span><span class="card-archive-list-count">1</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2023/03/"><span class="card-archive-list-date">三月 2023</span><span class="card-archive-list-count">8</span></a></li><li class="card-archive-list-item"><a class="card-archive-list-link" href="/archives/2021/09/"><span class="card-archive-list-date">九月 2021</span><span class="card-archive-list-count">3</span></a></li></ul></div><div class="card-widget card-webinfo"><div class="item-headline"><i class="fas fa-chart-line"></i><span>网站资讯</span></div><div class="webinfo"><div class="webinfo-item"><div class="item-name">文章数目 :</div><div class="item-count">41</div></div><div class="webinfo-item"><div class="item-name">已运行时间 :</div><div class="item-count" id="runtimeshow" data-publishDate="2022-03-10T16:00:00.000Z"></div></div><div class="webinfo-item"><div class="item-name">本站总字数 :</div><div class="item-count">112.5k</div></div><div class="webinfo-item"><div class="item-name">本站访客数 :</div><div class="item-count" id="busuanzi_value_site_uv"></div></div><div class="webinfo-item"><div class="item-name">本站总访问量 :</div><div class="item-count" id="busuanzi_value_site_pv"></div></div><div class="webinfo-item"><div class="item-name">最后更新时间 :</div><div class="item-count" id="last-push-date" data-lastPushDate="2024-04-21T07:25:54.443Z"></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright">&copy;2020 - 2024 By mowei</div><div class="footer_custom_text">海内存知已，天涯若比邻</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button><button id="translateLink" type="button" title="简繁转换">繁</button><button id="darkmode" type="button" title="浅色和深色模式转换"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"/></div></div></div><hr/><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="/js/tw_cn.js"></script><script src="https://cdn.jsdelivr.net/npm/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script src="/js/search/local-search.js"></script><script>var preloader = {
  endLoading: () => {
    document.body.style.overflow = 'auto';
    document.getElementById('loading-box').classList.add("loaded")
  },
  initLoading: () => {
    document.body.style.overflow = '';
    document.getElementById('loading-box').classList.remove("loaded")

  }
}
window.addEventListener('load',preloader.endLoading())</script><div class="js-pjax"><script>function subtitleType () {
  if (true) { 
    var typed = new Typed("#subtitle", {
      strings: "知识来自实践。,Knowledge comes from experience alone.,世间无所谓天才，它仅是刻苦加勤奋。,There is no such thing as genius; it is nothing but labour and diligence.".split(","),
      startDelay: 300,
      typeSpeed: 150,
      loop: true,
      backSpeed: 50
    })
  } else {
    document.getElementById("subtitle").innerHTML = '知识来自实践。'
  }
}

if (true) {
  if (typeof Typed === 'function') {
    subtitleType()
  } else {
    getScript('https://cdn.jsdelivr.net/npm/typed.js/lib/typed.min.js').then(subtitleType)
  }
} else {
  subtitleType()
}</script><script>if (document.getElementsByClassName('mermaid').length) {
  if (window.mermaidJsLoad) mermaid.init()
  else {
    getScript('https://cdn.jsdelivr.net/npm/mermaid/dist/mermaid.min.js').then(() => {
      window.mermaidJsLoad = true
      mermaid.initialize({
        theme: 'default',
      })
      true && mermaid.init()
    })
  }
}</script></div><div class="aplayer no-destroy" data-id="9385310356" data-server="netease" data-type="playlist" data-fixed="true" data-mini="true" data-listFolded="false" data-order="random" data-preload="none" data-autoplay="true" muted></div><canvas class="fireworks" mobile="false"></canvas><script src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/fireworks.min.js"></script><script defer="defer" id="fluttering_ribbon" mobile="false" src="https://cdn.jsdelivr.net/npm/butterfly-extsrc@1/dist/canvas-fluttering-ribbon.min.js"></script><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/aplayer/dist/APlayer.min.js"></script><script src="https://cdn.jsdelivr.net/gh/metowolf/MetingJS@1.2/dist/Meting.min.js"></script><script src="https://cdn.jsdelivr.net/npm/pjax/pjax.min.js"></script><script>let pjaxSelectors = [
  'title',
  '#config-diff',
  '#body-wrap',
  '#rightside-config-hide',
  '#rightside-config-show',
  '.js-pjax'
]

if (false) {
  pjaxSelectors.unshift('meta[property="og:image"]', 'meta[property="og:title"]', 'meta[property="og:url"]')
}

var pjax = new Pjax({
  elements: 'a:not([target="_blank"])',
  selectors: pjaxSelectors,
  cacheBust: false,
  analytics: false,
  scrollRestoration: false
})

document.addEventListener('pjax:send', function () {

  // removeEventListener scroll 
  window.removeEventListener('scroll', window.tocScrollFn)
  window.removeEventListener('scroll', scrollCollect)

  typeof preloader === 'object' && preloader.initLoading()
  
  if (window.aplayers) {
    for (let i = 0; i < window.aplayers.length; i++) {
      if (!window.aplayers[i].options.fixed) {
        window.aplayers[i].destroy()
      }
    }
  }

  typeof typed === 'object' && typed.destroy()

  //reset readmode
  const $bodyClassList = document.body.classList
  $bodyClassList.contains('read-mode') && $bodyClassList.remove('read-mode')

})

document.addEventListener('pjax:complete', function () {
  window.refreshFn()

  document.querySelectorAll('script[data-pjax]').forEach(item => {
    const newScript = document.createElement('script')
    const content = item.text || item.textContent || item.innerHTML || ""
    Array.from(item.attributes).forEach(attr => newScript.setAttribute(attr.name, attr.value))
    newScript.appendChild(document.createTextNode(content))
    item.parentNode.replaceChild(newScript, item)
  })

  GLOBAL_CONFIG.islazyload && window.lazyLoadInstance.update()

  typeof chatBtnFn === 'function' && chatBtnFn()
  typeof panguInit === 'function' && panguInit()

  // google analytics
  typeof gtag === 'function' && gtag('config', '', {'page_path': window.location.pathname});

  // baidu analytics
  typeof _hmt === 'object' && _hmt.push(['_trackPageview',window.location.pathname]);

  typeof loadMeting === 'function' && document.getElementsByClassName('aplayer').length && loadMeting()

  // Analytics
  if (false) {
    MtaH5.pgv()
  }

  // prismjs
  typeof Prism === 'object' && Prism.highlightAll()

  typeof preloader === 'object' && preloader.endLoading()
})

document.addEventListener('pjax:error', (e) => {
  if (e.request.status === 404) {
    pjax.loadUrl('/404.html')
  }
})</script><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div><script src="/live2d_models/lib/L2Dwidget.min.js?094cbace49a39548bed64abff5988b05"></script><script>L2Dwidget.init({"pluginRootPath":"live2d_models/","pluginJsPath":"lib/","pluginModelPath":"assets/","tagMode":false,"debug":false,"model":{"jsonPath":"/live2d_models/assets/wanko.model.json"},"display":{"position":"left","width":100,"height":150,"hOffset":-10,"vOffset":40},"mobile":{"show":true},"react":{"opacity":0.7},"log":false});</script></body></html>